#ifndef __BASE_GPIO_H
#define __BASE_GPIO_H


#include "stm32f10x.h"
#include "stm32f10x_gpio.h"

//#define GPIO_XX(GPIOx,GPIO_Pin) GPIO_SetBits(  GPIOx,  GPIO_Pin)

#define front_ch1(BitVal)  GPIO_WriteBit( GPIOB,  GPIO_Pin_12,(BitAction) BitVal)
#define front_ch2(BitVal)  GPIO_WriteBit( GPIOB,  GPIO_Pin_13, (BitAction)BitVal)
#define front_ch3(BitVal)  GPIO_WriteBit( GPIOB,  GPIO_Pin_14, (BitAction)BitVal)
#define front_ch4(BitVal)  GPIO_WriteBit( GPIOB,  GPIO_Pin_15, (BitAction)BitVal)


#define rear_ch1(BitVal)  GPIO_WriteBit( GPIOC,  GPIO_Pin_2, (BitAction)BitVal)
#define rear_ch2(BitVal)  GPIO_WriteBit( GPIOC,  GPIO_Pin_3,(BitAction) BitVal)
#define rear_ch3(BitVal)  GPIO_WriteBit( GPIOC,  GPIO_Pin_4,(BitAction) BitVal)
#define rear_ch4(BitVal)  GPIO_WriteBit( GPIOC,  GPIO_Pin_5, (BitAction)BitVal)


#define front_stop		 	front_ch1(1);front_ch2(1);front_ch3(1);front_ch4(1)
#define rear_stop 			rear_ch1(1);rear_ch2(1);rear_ch3(1);rear_ch4(1)

#define front_start_z		 	front_ch1(0);front_ch2(1);front_ch3(0);front_ch4(1)
#define front_start_f			front_ch1(1);front_ch2(0);front_ch3(1);front_ch4(0)


#define rear_start_z	 		rear_ch1(0);rear_ch2(1);rear_ch3(0);rear_ch4(1)
#define rear_start_f	 		rear_ch1(1);rear_ch2(0);rear_ch3(1);rear_ch4(0)

#define front_start_left 		front_ch1(1);front_ch2(0);front_ch3(0);front_ch4(1)
#define front_start_right		front_ch1(0);front_ch2(1);front_ch3(1);front_ch4(0)

#define rear_start_left	 		rear_ch1(1);rear_ch2(0);rear_ch3(0);rear_ch4(1)
#define rear_start_right	 	rear_ch1(0);rear_ch2(1);rear_ch3(1);rear_ch4(0)

#define car_front  	front_start_z;rear_start_z
#define car_rear 	front_start_f;rear_start_f

#define car_left  	front_start_left;rear_start_left
#define car_right 	front_start_right;rear_start_right

#define car_stop front_stop;rear_stop

void GPIO_car_config(void);

void GPIO_config(void);

#endif /* __SYSTICK_H */
